#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <unistd.h>

#include "netio.h"
#include "appsession.h"
#include "msgqueue.h"
#include "util.h"

int frame_decodec(AppSession *session, struct buffer *buff) {
//	int bigend = is_bigendian();
//	while (1) {
//		u_int32_t length_readable = buff->limit - buff->index;
//		if (length_readable <= 4) {
//			break;
//		}
//		u_int32_t mark = buff->index;
//
//		u_int16_t v;
//		bytes_to_short(buff, &v, bigend);
//		bytes_to_short(buff, &v, bigend);
//		if (length_readable < v) {
//			buff->index = mark;
//			break;
//		}
//
//		char *bytes_begin = buff->data + buff->index;
//		memcpy(NULL, bytes_begin, v - 4);
//		buff->index = buff->index + v - 4;
//		addmsg_4reading(session, NULL);
//	}
	return 0;
}

int frame_encodec(AppSession *session, void *msg) {
//	//TODO encode to a buffer
//	// we think you would release the msg object here.
//	// so when the byte-array sent ,you only need to release the struct buffer object;
//	addmsg_4writing(session, (struct buffer *) msg);
	return 0;
}

